package gupao.concurrency.threads;

import java.util.concurrent.TimeUnit;

public class Utils {
    public static void sleepIgnoreExp(long millis){
        try {
            TimeUnit.MILLISECONDS.sleep(millis);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    //等待interval纳秒
    public static void waitNanos(long nanos) {
        long start = System.nanoTime();
        long end;
        do {
            end = System.nanoTime();
        } while (start + nanos >= end);
    }
}
